P4 supports a number of operations for dealing with all processes at once.
p4_broadcastx
p4_broadcast
provide the ability to broadcast messages like p4_send and
p4_sendx.
p4_global_op
where op is one of:
and data_type is one of P4INT, P4LNG, P4FLT, or P4DBL.
This collection of routines provide the ability to do a variety of global operations. See the example programs in subdirectory p4/contrib. They apply the commutative operation op globally to x on an element-by-element basis and broadcast the result to all nodes. That is each process ends up with
op should be of the form
where data_type and operation are chosen appropriately.
The order in which nodes apply the operation is undefined (hence op must be commutative). The communication may be internally sub-blocked so the function op should not be hardwired to specific vector lengths.
This is still a relatively primitive version, which gathers the necessary data up a balanced binary tree and then uses p4_broadcast to send the results back.
barrier
p4_global_barrier
This procedure takes one argument which is the message type to be
used for internal message-passing. It causes the invoking process to
hang until all processes specified in the procgroup file have invoked
the procedure.
Functions for Shared Memory,Functions for Timing p4 Programs,Functions for Message Passing,Top